/*
 * Matthew Cramer, Jesse Martinez, Marc Mendoza 
 * CSE 325 Lab 4
 * File: Tests.c
 * Description: Program to test the IPC Manager.  Reports tests that
 *              are being done and if they passed or *FAILED*.  
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../QueueManager/QueueManager.h"
#include "../IPCManager/IPCManager.h"
#define MAX_QUEUE_SIZE 10

int main(int argc, char *argv[])
{
    int temp=0;
    char text1[500], text2[500];
    FILE *file1;
    FILE *file2;
    printf("\nTests for Lab 4 - IPC Manager\n");
    
/*********************************************
 Functionality Tests
 ********************************************/    
    printf("\n****Functionality Tests****\n");
    printf("These tests are conducted by comparing a sample\n");
    printf("output with the output of a file generated from\n");
    printf("running through the program.  These the output of\n");
    printf("the program checks the functionality of the functions\n");
    printf("and ensures that each output is correct.  If both\n");
    printf("of the files are the same, then the test PASSED.\n");
    printf("If both test files were not the same, then in FAILED.\n");
    printf("For a description of each test, see the documentation.\n");

    /*********************************************
     init_IPC
     Ensures that the init_IPC function is called
     at the start of the program 
     ********************************************/
    printf("\n**init_IPC**\n");
    temp=0;
    file1 = fopen("./Tests/Test_init_IPC.txt","r");
    file2 = fopen("./Tests/Test_init_IPC_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("init_IPC called at program start up: PASSED\n");
    else
        printf("init_IPC called at program start up: *FAILED*\n");
    
    /*********************************************
     init_IPC Arguments
     Ensures that the init_IPC function has the 
     correct numbers for the queues in the program
     ********************************************/
    printf("\n**init_IPC Arguments**\n");
    temp=0;
    file1 = fopen("./Tests/Test_init_IPC_ARG.txt","r");
    file2 = fopen("./Tests/Test_init_IPC_ARG_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("init_IPC Arguments: PASSED\n");
    else
        printf("init_IPC Arguments: *FAILED*\n");
    
    /*********************************************
     List
     Ensures that List displays the current queues
     in use and the argument is the right queue
     being used
     ********************************************/
    printf("\n**List**\n");
    temp=0;
    file1 = fopen("./Tests/Test_List.txt","r");
    file2 = fopen("./Tests/Test_List_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("List: PASSED\n");
    else
        printf("List: *FAILED*\n");
    
    /*********************************************
     List Display
     Ensures that List displays the current queues
     in use and the argument is the right queue
     being used
     ********************************************/
    printf("\n**List Display**\n");
    temp=0;
    file1 = fopen("./Tests/Test_List_Display.txt","r");
    file2 = fopen("./Tests/Test_List_Display_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("List Display: PASSED\n");
    else
        printf("List Display: *FAILED*\n");
    
    /*********************************************
     HAS_Message
     Ensures that HAS_Message displays the correct 
     output for a command
     ********************************************/
    printf("\n**HAS_Message**\n");
    temp=0;
    file1 = fopen("./Tests/Test_HAS_Message.txt","r");
    file2 = fopen("./Tests/Test_HAS_Message_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("HAS_Message: PASSED\n");
    else
        printf("HAS_Message: *FAILED*\n");
    
    
    /*********************************************
     HAS_Message Arguments
     Ensures that HAS_Message takes in the correct 
     number of arguments and errors if not
     ********************************************/
    printf("\n**HAS_Message Arguments**\n");
    temp=0;
    file1 = fopen("./Tests/Test_HAS_Message_ARG.txt","r");
    file2 = fopen("./Tests/Test_HAS_Message_ARG_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("HAS_Message Arguments: PASSED\n");
    else
        printf("HAS_Message Arguments: *FAILED*\n");
    
    
    /*********************************************
     Send
     Ensures that Send sends a message to
     the correct queue if the source and destination
     exist and the queue contains that message afterwards.  
     ********************************************/
    printf("\n**Send**\n");
    temp=0;
    file1 = fopen("./Tests/Test_Send.txt","r");
    file2 = fopen("./Tests/Test_Send_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("Send: PASSED\n");
    else
        printf("Send: *FAILED*\n");
    
    /*********************************************
     Send Arguments
     Ensures that Send has the correct number of
     arguments and the right queues
     ********************************************/
    printf("\n**Send Arguments**\n");
    temp=0;
    file1 = fopen("./Tests/Test_Send_ARG.txt","r");
    file2 = fopen("./Tests/Test_Send_ARG_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("Send Arguments: PASSED\n");
    else
        printf("Send Arguments: *FAILED*\n");
    
    /*********************************************
     Retrieve
     Ensures that Retrieve returns the right data 
     when called and that the queue exists to be
     retrieved from
     ********************************************/
    printf("\n**Retrieve**\n");
    temp=0;
    file1 = fopen("./Tests/Test_Retrieve.txt","r");
    file2 = fopen("./Tests/Test_Retrieve_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("Retrieve: PASSED\n");
    else
        printf("Retrieve: *FAILED*\n");
    
    
    /*********************************************
     Retrieve Arguments
     Ensures that Retrieve gets the correct number
     of arguments and errors if not
     ********************************************/
    printf("\n**Retrieve Arguments**\n");
    temp=0;
    file1 = fopen("./Tests/Test_Retrieve_ARG.txt","r");
    file2 = fopen("./Tests/Test_Retrieve_ARG_OUTPUT.txt","r");
    if(file1 != NULL && file2 != NULL)
    {
        fgets(text1,500,file1);
        fgets(text2,500,file2);
        while((fgets(text1,500,file1) != NULL && fgets(text2,500,file2) != NULL) && temp != 1)
        {
            if(strcmp(text1, text2) != 0)
                temp = 1;
        }
        fclose(file1);
        fclose(file2);
    }
    else
        temp = 1;
    if(temp==0)
        printf("Retrieve Arguments: PASSED\n");
    else
        printf("Retrieve Arguments: *FAILED*\n");
    
    
/*********************************************
 Capacitiy Tests
********************************************/    
    
    printf("\n****Capacitiy Tests****\n");
   
    /*********************************************
     Empty Queues
     Ensures that all queues are initialized correctly
     ********************************************/  
    printf("**Empty Queues**\n");

    //Initiate All Queues for testing
    clearQueues(10);
    
    //Queue 1
    if(getHead(1) == -1 && getTail(1) == -1 && getSizeOfQueue(1) == 0)
        printf("Queue  1: PASSED\n");
    else
        printf("Queue  1: *FAILED*\n");
    //Queue 2
    if(getHead(2) == -1 && getTail(2) == -1 && getSizeOfQueue(2) == 0)
        printf("Queue  2: PASSED\n");
    else
        printf("Queue  2: *FAILED*\n");
    //Queue 3
    if(getHead(3) == -1 && getTail(3) == -1 && getSizeOfQueue(3) == 0)
        printf("Queue  3: PASSED\n");
    else
        printf("Queue  3: *FAILED*\n");
    //Queue 4
    if(getHead(4) == -1 && getTail(4) == -1 && getSizeOfQueue(4) == 0)
        printf("Queue  4: PASSED\n");
    else
        printf("Queue  4: *FAILED*\n");
    //Queue 5
    if(getHead(5) == -1 && getTail(5) == -1 && getSizeOfQueue(5) == 0)
        printf("Queue  5: PASSED\n");
    else
        printf("Queue  5: *FAILED*\n");
    //Queue 6
    if(getHead(6) == -1 && getTail(6) == -1 && getSizeOfQueue(6) == 0)
        printf("Queue  6: PASSED\n");
    else
        printf("Queue  6: *FAILED*\n");
    //Queue 7
    if(getHead(7) == -1 && getTail(7) == -1 && getSizeOfQueue(7) == 0)
        printf("Queue  7: PASSED\n");
    else
        printf("Queue  7: *FAILED*\n");
    //Queue 8
    if(getHead(8) == -1 && getTail(8) == -1 && getSizeOfQueue(8) == 0)
        printf("Queue  8: PASSED\n");
    else
        printf("Queue  8: *FAILED*\n");
    //Queue 9
    if(getHead(9) == -1 && getTail(9) == -1 && getSizeOfQueue(9) == 0)
        printf("Queue  9: PASSED\n");
    else
        printf("Queue  9: *FAILED*\n");
    //Queue 10
    if(getHead(10) == -1 && getTail(10) == -1 && getSizeOfQueue(10) == 0)
        printf("Queue 10: PASSED\n");
    else
        printf("Queue 10: *FAILED*\n");


    /*********************************************
     Max Queues
     Ensures that all queues can be filled to capacity
     ********************************************/    
    printf("\n**Max Queues**\n");
    
    //Initiate All Queues
    clearQueues(10);
    int i=0;
    int test;
    
    //Queue 1
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(10,1,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  1: PASSED\n");
    else
        printf("Queue  1: *FAILED*\n");
    
    //Queue 2
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(1,2,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  2: PASSED\n");
    else
        printf("Queue  2: *FAILED*\n");
    
    //Queue 3
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(2,3,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  3: PASSED\n");
    else
        printf("Queue  3: *FAILED*\n");
    
    //Queue 4
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(3,4,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  4: PASSED\n");
    else
        printf("Queue  4: *FAILED*\n");
    
    //Queue 5
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(4,5,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  5: PASSED\n");
    else
        printf("Queue  5: *FAILED*\n");
    
    //Queue 6
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(5,6,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  6: PASSED\n");
    else
        printf("Queue  6: *FAILED*\n");
    
    //Queue 7
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(6,7,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  7: PASSED\n");
    else
        printf("Queue  7: *FAILED*\n");
    
    //Queue 8
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(7,8,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  8: PASSED\n");
    else
        printf("Queue  8: *FAILED*\n");
    
    //Queue 9
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(8,9,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue  9: PASSED\n");
    else
        printf("Queue  9: *FAILED*\n");
    
    //Queue 10
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE+1; i++)
    {
        if(Send(9,10,i+1) == 0)
            test++;
    }
    if(test == MAX_QUEUE_SIZE)
        printf("Queue 10: PASSED\n");
    else
        printf("Queue 10: *FAILED*\n");
    
    /*********************************************
     Max Queues/Clear Some
     Ensures that the queues can be filled to capacity
     and then delete some elements
     ********************************************/
    printf("\n**Max Queues/Clear Some**\n");
    
    //Initiate All Queues
    clearQueues(10);
    
    //Queue 1
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(10,1,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(1) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  1: PASSED\n");
    else
        printf("Queue  1: *FAILED*\n");
    
    //Queue 2
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(1,2,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(2) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  2: PASSED\n");
    else
        printf("Queue  2: *FAILED*\n");
    
    //Queue 3
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(2,3,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(3) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  3: PASSED\n");
    else
        printf("Queue  3: *FAILED*\n");
    
    //Queue 4
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(3,4,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(4) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  4: PASSED\n");
    else
        printf("Queue  4: *FAILED*\n");
    
    //Queue 5
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(4,5,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(5) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  5: PASSED\n");
    else
        printf("Queue  5: *FAILED*\n");
    
    //Queue 6
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(5,6,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(6) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  6: PASSED\n");
    else
        printf("Queue  6: *FAILED*\n");
    
    //Queue 7
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(6,7,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(7) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  7: PASSED\n");
    else
        printf("Queue  7: *FAILED*\n");
    
    //Queue 8
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(7,8,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(8) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  8: PASSED\n");
    else
        printf("Queue  8: *FAILED*\n");
    
    //Queue 9
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(8,9,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(9) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue  9: PASSED\n");
    else
        printf("Queue  9: *FAILED*\n");
    
    //Queue 10
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(9,10,i+1) == 0)
            test++;
    }
    for(i=0; i<5; i++)
    {
        if(Retrieve(10) == i+1)
            test--;
    }
    if(test == MAX_QUEUE_SIZE-5)
        printf("Queue 10: PASSED\n");
    else
        printf("Queue 10: *FAILED*\n");
    
    /*********************************************
     Max Queues/Clear All
     Ensures the queues can be filled to capacity
     and then delete all the queues to leave the
     queues empty
    ********************************************/
    printf("\n**Max Queues/Clear All**\n");

    //Initialize All Queues
    clearQueues(10);
    
    //Queue 1
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(10,1,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(1) == i+1)
            test--;
    }
    if(getHead(1) == -1 && getTail(1) == -1 && getSizeOfQueue(1) == 0 && test == 0)
        printf("Queue  1: PASSED\n");
    else
        printf("Queue  1: *FAILED*\n");
    
    //Queue 2
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(1,2,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(2) == i+1)
            test--;
    }
    if(getHead(2) == -1 && getTail(2) == -1 && getSizeOfQueue(2) == 0 && test == 0)
        printf("Queue  2: PASSED\n");
    else
        printf("Queue  2: *FAILED*\n");
    
    //Queue 3
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(2,3,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(3) == i+1)
            test--;
    }
    if(getHead(3) == -1 && getTail(3) == -1 && getSizeOfQueue(3) == 0 && test == 0)
        printf("Queue  3: PASSED\n");
    else
        printf("Queue  3: *FAILED*\n");
    
    //Queue 4
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(3,4,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(4) == i+1)
            test--;
    }
    if(getHead(4) == -1 && getTail(4) == -1 && getSizeOfQueue(4) == 0 && test == 0)
        printf("Queue  4: PASSED\n");
    else
        printf("Queue  4: *FAILED*\n");
    
    //Queue 5
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(4,5,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(5) == i+1)
            test--;
    }
    if(getHead(5) == -1 && getTail(5) == -1 && getSizeOfQueue(5) == 0 && test == 0)
        printf("Queue  5: PASSED\n");
    else
        printf("Queue  5: *FAILED*\n");
    
    //Queue 6
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(5,6,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(6) == i+1)
            test--;
    }
    if(getHead(6) == -1 && getTail(6) == -1 && getSizeOfQueue(6) == 0 && test == 0)
        printf("Queue  6: PASSED\n");
    else
        printf("Queue  6: *FAILED*\n");
    
    //Queue 7
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(6,7,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(7) == i+1)
            test--;
    }
    if(getHead(7) == -1 && getTail(7) == -1 && getSizeOfQueue(7) == 0 && test == 0)
        printf("Queue  7: PASSED\n");
    else
        printf("Queue  7: *FAILED*\n");
    
    //Queue 8
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(7,8,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(8) == i+1)
            test--;
    }
    if(getHead(8) == -1 && getTail(8) == -1 && getSizeOfQueue(8) == 0 && test == 0)
        printf("Queue  8: PASSED\n");
    else
        printf("Queue  8: *FAILED*\n");
    
    //Queue 9
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(8,9,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(9) > 0)
            test--;
    }
    if(getHead(9) == -1 && getTail(9) == -1 && getSizeOfQueue(9) == 0 && test == 0)
        printf("Queue  9: PASSED\n");
    else
        printf("Queue  9: *FAILED*\n");
    
    //Queue 10
    test=0;
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Send(9,10,i+1) == 0)
            test++;
    }
    for(i=0; i<MAX_QUEUE_SIZE; i++)
    {
        if(Retrieve(10) > 0)
            test--;
    }
    if(getHead(10) == -1 && getTail(10) == -1 && getSizeOfQueue(10) == 0 && test == 0)
        printf("Queue 10: PASSED\n");
    else
        printf("Queue 10: *FAILED*\n");
   
    printf("\n***TESTS COMPLETED****\n\n");

    return 0;
}
